package DAO;

import bean.User;

public class UserDao {
    private BaseDao baseDao=new BaseDao();
    private String sql;
    public User getUserByID(String username){
        sql="select * from user where username=?";
        return baseDao.queryForOne(sql,User.class,username);
    }
    public int deleteUserByID(String username){
        sql="update user set state=0 where username=?";
        return baseDao.update(sql,username);
    }
    public int updateUser(User user) {
        sql = "update user set name=?, email=?, avatar=? where username=?";
        return baseDao.update(sql, user.getName(), user.getEmail(), user.getAvatar(), user.getUsername());
    }
    public static void main(String[] args) {
        System.out.println(new UserDao().deleteUserByID("13001234567"));
    }
}
